Skip to content

Conversation

@delmorallopez
Copy link

Preparation exercise from Sprint5

@delmorallopez delmorallopez added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Dec 10, 2025
@LonMcGregor LonMcGregor added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Jan 14, 2026
Copy link

@LonMcGregor LonMcGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good work on these tasks, there are some areas where you could improve further

Also,consider if it is a good idea to have all these files in the main directory for this sprint

# - Methods support inheritance
# - Better organization
# - Better organization
# - Methods enable polymorphism

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good answers!

generics.py Outdated
def print_family_tree(person: Person) -> None:
print(person.name)
for child in person.children:
print(f"- {child.name} ({child.age})")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this print grandchildren recursively?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made print_family_tree recursive, so it prints children, grandchildren, great-grandchildren...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to change the validation to allow for reentry if the input was invalid, rather than exiting immediately

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have modify the code, crating a while loop, each input is wrapped in a while True loop. Only break from the loop when a valid value is entered. Invalid entries print an error to stderr but don’t exit, so the user can retry.

@LonMcGregor LonMcGregor added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jan 14, 2026
@delmorallopez delmorallopez added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants